package com.anysoft.util;

import org.apache.commons.lang3.StringUtils;

/**
 * JoinProperties
 */
public class JoinProperties extends DefaultProperties{
    protected Properties left = null;
    protected Properties right = null;

    public JoinProperties(Properties parent){
        super("default",parent);
    }

    public void setLeft(Properties left){
        this.left = left;
    }

    public void setRight(Properties right){
        this.right = right;
    }

    @Override
    protected String _GetValue(String _name) {
        String value = "";
        if (left != null){
            value = PropertiesConstants.getRaw(left,_name,value);
        }
        if (StringUtils.isEmpty(value) && right != null){
            value = PropertiesConstants.getRaw(right,_name,value);
        }

        if (StringUtils.isEmpty(value) && right != null){
            value = super._GetValue(_name);
        }

        return value;
    }
}
